<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
		<title>互评打分wind</title>
		<link rel="stylesheet" type="text/css" href="../../css/api.css"/>
		<link rel="stylesheet" href="../../css/mui.min.css" />
		<link rel="stylesheet" href="../../css/base.css">
		<style>
			.base_back_icon_right {
				height: 20px;
				position: absolute;
				top: 50%;
				right: 15px;
				margin-top: -11px;
			}
			html, body {
				background-color: #f3f5f7;
			}
			.top-hand-div-style {
				text-align: center;
				margin-top: 80px;
				background-color: #FFFFFF;
				border: 2px solid #FFFFFF;
				border-radius: 6px;
				margin-right: 10px;
				margin-left: 10px;
				padding-top: 20px;
				padding-bottom: 20px;
				position: absolute;
				left: 0;
				right: 0;
				top: 0;
				bottom: 50px;
			}
			.top-hand-img-style {
				width: 120px;
				height: 120px;
				border-radius: 60px;
			}
			.top-hand-span-style {
				display: block;
				/*padding-bottom: 20px;*/
			}
			.bottom-btn-div {
				position: absolute;
				bottom: 0;
				width: 100%;
				background-color: #18b4ed;
				color: #FFFFFF;
				line-height: 40px;
				text-align: center;
			}
			.colorred {
				color: #D85B65;
			}
			#middleId {
				margin-top: 10px;
			}
			.input-style {
				/*width: 20px;
				 float: left;*/
			}
			input[type=number], input[type=tel] {
				line-height: 21px;
				width: 40px;
				height: 40px;
				margin-top: 5px;
				margin-bottom: 15px;
				padding: 10px 12px;
				-webkit-user-select: text;
				border: 1px solid rgba(0,0,0,.2);
				border-radius: 3px;
				outline: 0;
				background-color: #fff;
				-webkit-appearance: none;
				margin-right: 10px;
			}
			.noSign {
				margin-top: 100px;
			}
			#taiduNum1 > img {
				width: 30px;
			}
		</style>
	</head>
	<body>
		<div class="base_style_color base_title_Immerse" id='BarAppearance base_title_Immerse' ></div>
		<div class="base_navigation_bar base_style_color base_navigation_item_bar base_title_position" >
			<a class="base_left_item" href="#" onclick="backClick()"> <img class="base_back_icon" src="../../image/icon_jiantou.png" alt=""> </a>
			<span id="newsTitle">互评</span>
			<a class="base_right_item nav-item" id="wancheng"onclick="historyClick()"> <img class="base_back_icon_right" src="../../image/icon_mutualrating__history.png" alt=""> </a>
		</div>
		<div id="mian"  >
			<div class="top-hand-div-style" >
				<img src="../../image/icon_mutualrating_add.png"  class="top-hand-img-style" id="headImgId"/>
				<span class="base_content_font base_black_grey top-hand-span-style" id="headNameId" > 选择人员</span>
				<span class="base_content_font base_dark_grey_shallow top-hand-span-style" style="margin-top: 50px;" >评分</span>
				<div  id="taiduNum1">
					<img src="../../image/icon_xingxingblue01.png" id="imgId">
					<img src="../../image/icon_xingxingblue01.png">
					<img src="../../image/icon_xingxingblue01.png">
					<img src="../../image/icon_xingxingblue01.png">
					<img src="../../image/icon_xingxingblue01.png">
					<img src="../../image/icon_xingxingblue01.png" hidden="hidden">
				</div>
				<!-- <div id="wrap" >
				<input  class="base_dark_grey base_content_font" type="tel"  maxlength="1"  id="num1" onkeyup="this.value=this.value.replace(/\D/g,'')">
				<input class="base_dark_grey base_content_font"  type="tel" maxlength="1" id="num2"  onkeyup="this.value=this.value.replace(/\D/g,'')" >
				<input class="base_dark_grey base_content_font" type="tel"  maxlength="1" id="num3"  onkeyup="this.value=this.value.replace(/\D/g,'')" >
				</div>-->
			</div>
			<div class="bottom-btn-div base_title_font" onclick="Doscore()">
				提交
			</div>
		</div>
		<div class="noSign"  id="noData"  hidden="hidden">
			<img src="../../image/icon_mutalarating_nodata.png" width="60%">
			<p class="font16 top_15 base_dark_grey" >
				提交失败</br>
				互评已结束
			</p>
		</div>
	</body>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script type="text/javascript" src="../../script/MD5.js"></script>
	<script src="../../script/jquery.min.js" type="text/javascript"></script>
	<script type="text/javascript" src="../../script/requestTool.js"></script>
	<script src="../../script/common.js"></script>
	<script type="text/javascript">
		var pageParam = '';
		var score = '';
		apiready = function() {
			pageParam = api.pageParam;
			setAddhtml();
			listenScroll();
			setupStarClick();
			//	$("#taiduNum img").eq(sxtd).prevAll().attr("src", "../../image/icon_xingxing.png")
			sendBuriedNotifi('0', '学生端互评页', '186');
		}
		function setupStarClick() {
			$('#taiduNum1 img').each(function(i) {
				$(this).click(function() {
					$(this).attr('src', '../../image/icon_xingxingblue.png');
					$(this).prevAll().attr('src', '../../image/icon_xingxingblue.png');
					$(this).nextAll().attr('src', '../../image/icon_xingxingblue01.png');
					score = ($(this).prevAll().length + 1) * 20;
				})
			});
		}

		//设置输入框自动跳转到下一个
		function onload() {
			var txts = wrap.getElementsByTagName("input");
			//             $("input[type]").attr('type','nu');
			for (var i = 0; i < txts.length; i++) {
				var t = txts[i];
				t.index = i;
				t.onkeyup = function() {
					this.value = this.value.replace(/^(.).*$/, '$1');
					var next = this.index + 1;
					if (next > txts.length - 1)
						return;
					txts[next].focus();
				}
			}
			txts[0].removeAttribute("readonly");
		}

		//设置内容
		function setAddhtml() {
			$("#headImgId").attr("src", headImgUrl(pageParam.picurl));
			$("#headNameId").html(pageParam.name);
			$(".bottom-btn-div").addClass("backgroundcolorblue");
		}

		//历史记录
		function historyClick() {
			api.openWin({useWKWebView:true,
				name : 'MutualRatingHistoryViewWind',
				url : 'MutualRatingHistoryViewWind.html',
				pageParam : api.pageParam
			});
		}

		function Doscore() {
			if (parseInt(score) > 0) {
				postscore(score);
			} else {
				ShowToast("分数不可为空");
			}
		}

		function postscore(score) {
			var params = {
				jid : $api.getStorage('cfnetppjxid'),
				uid : pageParam.stuid,
				iid : pageParam.id,
				tid : 7,
				score : score
			};
			showProgress();
			//				alert(JSON.stringify(params));
			cfnetppPOST(url_stuDoSign, params, true, function(data, status) {
				//					alert(JSON.stringify(data));
				//coding...
				if (data) {
					hideProgress();
					if (data.code == 200) {
						api.sendEvent({
							name : 'openStudentMutualRatingViewWindNotice',
							extra : {
								stuid : pageParam.stuid,
								id : pageParam.id,
								type : 10058,
								status : 3
							}
						});
						api.sendEvent({
							name : 'pushMessage_classroomMessage',
							extra : {
								type : 10058,
								id : pageParam.id,
								jid : $api.getStorage('cfnetppjxid')
							}
						});
						api.closeFrame({
						});
					} else if (data.code == 108) {
						ShowToast("提交失败，请重新提交");
					} else if (data.code == 106) {
						$("#mian").hide();
						$("#noData").show();
					} else {
						ShowToast("提交失败，请重新提交");
					}
				}
			});
		}

		function sendBuriedNotifi(busionessid, pagetype, pagetypeid) {
			var userinfo = {
				uid : $api.getStorage('cfnetppuid'),
				jid : $api.getStorage('cfnetppjxid'),
				uname : $api.getStorage('cfnetppusername'),
			}
			var data = {
				busionessid : busionessid,
				pagetype : pagetype,
				pagetypeid : pagetypeid,
				sourceurl : api.pageParam.sourceurl,
				sourcetitle : api.pageParam.sourcetitle,
				accesspageurl : window.location.pathname,
				accesspagetitle : document.title,
				userinfo : userinfo
			}
			SendBehaviorTrajectoriesNotifi_Study(data);
		}

		// 滚动监听
		function listenScroll() {
			var clientHeight = document.documentElement.clientHeight || document.body.clientHeight;
			$(window).resize(function() {
				var nowClientHeight = document.documentElement.clientHeight || document.body.clientHeight;
				if (clientHeight > nowClientHeight) {
					//当软键盘弹出，在这里面操作
					$(".bottom-btn-div").css('display', 'none');
					$(".top-hand-div-style").css('bottom', -30);
				} else {
					$(".bottom-btn-div").css('display', 'block');
					$(".top-hand-div-style").css('bottom', 50 + 'px');
					//当软键盘收起，在此处操作
				}
			});
		}
	</script>
</html>